package ar.unc.famaf.pln.giveselector.classifier;

import java.util.Date;

import ar.unc.famaf.pln.giveselector.context.Response;

/**
 * This class represents an Occurrence object that has
 * been classified by a Classificator ;).
 * 
 * @author David Racca ( david.racca@gmail.com )
 *
 */
@SuppressWarnings("serial")
public class ClassifiedOccurrence extends Occurrence 
{
	protected float score;

	public static final float S = 1f;		// Discrete scores, S = SUCCESS
	public static final float F = -1f;		// F = FAILURE
	public static final float BS = .5f;		// BS = BORROWED_SUCCESS
	public static final float BF = -.5f;	// BF = BORROWED_FAILURE


	/**
	 * Creates a new ClassifiedOccurrence with the given
	 * parameters.
	 */
	public ClassifiedOccurrence(UtteranceP owner, Integer gameId,
			Date timestamp, Response reaction, float score) 
	{
		super(owner, gameId, timestamp, reaction);
		this.score = score;
	}


	/**
	 * Creates a new ClassifiedOccurrence object by copying 
	 * the given Occurrence object and adding to it the given
	 * Classification.
	 */
	public ClassifiedOccurrence(Occurrence o, float c)
	{
		super(o.getOwner(), o.getGameId(), o.getTimestamp(), o.getResponse());
		for (Occurrence related : o.getRelatedOccurrences())
		{
			this.addRelatedOccurrence(related);
		}
		this.score = c;
	}


	/**
	 * @return The score for this instance.
	 */
	public float getScore()
	{
		return score;
	}


	/**
	 * @return A string representation for this object. 
	 */
	public String toString()
	{
		return super.toString() + " " + score; 
	}


}